package com.yexiao.cofe;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@Slf4j
public class CofeApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext context = SpringApplication.run(CofeApplication.class, args);
        ServletWebServerApplicationContext webContext = (ServletWebServerApplicationContext) context;
        int port = webContext.getWebServer().getPort();
        InetAddress localHost = InetAddress.getLocalHost();

        log.info("启动成功, {}:{}", localHost, port);
    }

}
